package com.yinian.core;

import com.yinian.dao.MessageDao;
import com.yinian.entity.Message;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

@Component
public class Consumer {

    @Autowired
    private MessageDao messageDao;


    /**
     * 使用JmsListener配置消费者监听的队列，其中text是接收到的消息
     *
     * @param text
     */
    @JmsListener(destination = "mytest.queue")
    public void receiveQueue(String text) {
        /*Message message = new Message(text);
        messageDao.save(message);*/
        System.out.println(text);
    }
}  